package com.pks.datacenter.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.events.SessionCreatedEvent;
import org.springframework.session.events.SessionDeletedEvent;
import org.springframework.session.events.SessionExpiredEvent;

import com.pks.datacenter.handler.RedisHandler;

@Configuration  
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 4*60*60,redisNamespace="datacenter") 
public class RedisSessionConfig {
	
	@Autowired
	private RedisHandler redisHandler;
	
	@EventListener
	public void onSessionCreated(SessionCreatedEvent event){
//		logger.error(event.getSessionId());
		//TODO  session 创建需要执行的内容
	}
	
	@EventListener
	public void onSessionDeleted(SessionDeletedEvent event){

	}
	
	@EventListener
	public void onSessionExpired(SessionExpiredEvent event){

	}
	
	
}
